home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 476-500 / disk_498 / wordsearch / src / words.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  779b  |  63 lines

  1. #include "wsearch.h"
  2.  
  3. void CleanUp()
  4. {
  5.     int i,j;
  6.     
  7.     j=0;
  8.     for(i=0;i<MAXWORD;i++)
  9.     {
  10.         if(word[i][0]!=0)
  11.         {
  12.             if(i!=j)
  13.             {
  14.                 strcpy(word[j],word[i]);
  15.             }
  16.             j++;
  17.         }
  18.     }
  19.     for(i=j;i<MAXWORD;i++)
  20.         word[i][0] = 0;
  21. }
  22.             
  23. void UpperCase()
  24. {
  25.     int i,j;
  26.     
  27.     for(i=0;i<MAXWORD;i++)
  28.     {
  29.         j=0;
  30.         while(word[i][j]!=0)
  31.         {
  32.             if(word[i][j]>='a' && word[i][j]<='z')
  33.                 word[i][j]=word[i][j]-('a'-'A');
  34.             j++;
  35.         }
  36.     }
  37. }
  38.  
  39. void Sort()
  40. {
  41.     int i,j,ls;
  42.     char buffer[MAXSIZE+1];
  43.     
  44.     ls=MAXWORD-1;
  45.     while(ls>0)
  46.     {
  47.         j=0;
  48.         for(i=0;i<ls;i++)
  49.         {
  50.             if((strncmp(word[i],word[i+1],MAXSIZE)>0
  51.                 && word[i+1][0]!=0) ||
  52.                 (word[i][0]==0 && word[i+1][0]!=0))
  53.                 {
  54.                 j=i;
  55.                 strcpy(buffer,word[i]);
  56.                 strcpy(word[i],word[i+1]);
  57.                 strcpy(word[i+1],buffer);
  58.                 }
  59.         }
  60.         ls = j;
  61.     }
  62. }
  63.